<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>计算属性</title>
    <script src="vue3.js"></script>
</head>
<body>
    <div id="app">
        <input v-model="a"/>+
        <input v-model="b"/>+
        <input v-model="c"/>=
        <h2>{{total}}</h2>
        <h2>{{total}}</h2>
    </div>
    <script>
        let {createApp} = Vue
        createApp({
            data(){
                return{
                    a:0,
                    b:0,
                    c:0,
                }
            },
            methods:{
                sum(){
                    console.log('sum...methods')
                    return parseInt(this.a)+parseInt(this.b)+parseInt(this.c)
                }
            },
            computed:{
                total(){
                    console.log('total...computed')
                    return parseInt(this.a)+parseInt(this.b)+parseInt(this.c)
                }
            }
        }).mount('#app')
    </script>
</body>
</html>